package com.jy.appmarket.network.engine;

import java.util.Map;

import android.content.Context;

import com.jy.appmarket.network.resultdata.PageResult;

public class CardPageNetEngine extends BaseNetEngine {
	private String mPath;
	private long mDataVersion;
	private int mPageNO;
	private Map<String, String> mParams;

	public CardPageNetEngine(String path, long dataVersion, int pageNo, Map<String, String> params) {
		mPath = path;
		mDataVersion = dataVersion;
		mPageNO = pageNo;
		mParams = params;
		mResultData = new PageResult();
	}

	public CardPageNetEngine(String path, long dataVersion, int pageNo) {
		this(path, dataVersion, pageNo, null);
	}

	@Override
	protected String getCommand() {
		return mPath;
	}

	@Override
	protected void getParams(Context context, Map<String, String> custParams) {
		if (mPageNO != 1) {
			custParams.put("pageNo", String.valueOf(mPageNO));
		}

		if (mDataVersion != 0) {
			custParams.put("dataVersion", String.valueOf(mDataVersion));
		}

		if (mParams != null && !mParams.isEmpty()) {
			custParams.putAll(mParams);
		}

	}
}
